import os
import time
import  multiprocessing


def working():
    print(f'获取当前进程编号{os.getpid()}')
    print(f'获取当前进程的父进程编号{os.getppid()}')
    for i in range(3):
        print('working')
        time.sleep(1)

if __name__ == '__main__':
    print(f'主进程编号为{os.getpid()}')
    sub_process = multiprocessing.Process(target=working)
    sub_process.start()